Package MusicLandscape.entities
Class Artist
- java.lang.Object
-
- MusicLandscape.entities.Artist
-
public class Artist extends java.lang.ObjectThis class represents an artist of performing arts, like a band.- Since:
- ExerciseSheet01
- Version:
- 3
- Author:
- Jonas Altrock (ew20b126@technikum-wien.at)
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringnameholds the name of the artist
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetName()gets the name of this artist.voidsetName(java.lang.String name)sets the name of this artist.java.lang.StringtoString()returns a String representation of this Artist
-
-
-
Constructor Detail
-
Artist
public Artist()
creates a default artista default artists name is the String "unknown" (without quotes)
-
Artist
public Artist(java.lang.String name)
creates an artist with a certain name- Parameters:
name- the name of this artist
-
Artist
public Artist(Artist other)
creates a copy of an artist- Parameters:
other- the original artist to be copied
-
-
Method Detail
-
getName
public java.lang.String getName()
gets the name of this artist.- Returns:
- the name
-
setName
public void setName(java.lang.String name)
sets the name of this artist.the name of an artist cannot be null or empty. if an invalid argument is passed to the method the state of the object remains unchanged
- Parameters:
name- the new name of the artist
-
toString
public java.lang.String toString()
returns a String representation of this ArtistThis should be either the name of the Artist, or "unknown" if the name is not available
- Overrides:
toStringin classjava.lang.Object- Returns:
- the string representation
-
-